a=c(1,2,3,4,5,6,7,8,9,10)
b=c("a","b","c","a","b","c","b","a","b","c")
c=c(10,20,30,40,50,60,70,80,90,100)
d=c(2,4,6,8,10,12,14,16,18,20)
tapply(a,b,mean)
data.frame(a,b,c,d)